﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pibby.Core.UnitTests.Stubs
{
	public class EpisodeStub : IEpisode
	{
		public EpisodeStub(string name, DateTime pub)
		{
			this.Name = name;
			this.PublicationDate = pub;
		}

		public string Name
		{
			get;
			set;
		}

		public DateTime PublicationDate
		{
			get;
			set;
		}

		public EpisodeAge Age
		{
			get;
			set;
		}

		public EpisodeLifecycle Stage
		{
			get;
			set;
		}

		public long FileSize
		{
			get;
			set;
		}

		public static List<IEpisode> BuildNEpisodes(int n)
		{
			return EpisodeStub.BuildNDatedEpisodes (DateTime.Today, n);
		}

		public static List<IEpisode> BuildNDatedEpisodes(DateTime fromDate, int n)
		{
			List<IEpisode> eps = new List<IEpisode>();

			for (int i = 0; i < n; ++i)
			{
				EpisodeStub e = new EpisodeStub(string.Format("Episode{0}", i), fromDate.AddDays(-i));
				eps.Add(e);
			}

			return eps;
		}


		#region IComparable<IEpisode>

		public int CompareTo(IEpisode other)
		{
			return this.PublicationDate.CompareTo(other.PublicationDate);
		}

		#endregion

	}
}
